class Solution:
    def compareVersion(self, version1: str, version2: str) -> int:
        v1 = version1.split(".")
        v2 = version2.split(".")
        for i in range(min(len(v1), len(v2))):
            intV1 = int(v1[i])
            intV2 = int(v2[i])
            if intV1 == intV2:
                continue
            elif intV1 > intV2:
                return 1
            else:
                return -1
        len1 = len(v1)
        len2 = len(v2)
        if len1 == len2:
            return 0
        elif len1 > len2:
            for i in range(len2, len1):
                if int(v1[i]) != 0:
                    return 1
            return 0
        else:
            for i in range(len1, len2):
                if int(v2[i]) != 0:
                    return -1
            return 0


if __name__ == '__main__':
    so = Solution()
    version1 = "1"
    version2 = "1.1"
    r = so.compareVersion(version1, version2)
    print(r)
